﻿-- Define the relationship between ActivityLink and Person
ALTER TABLE [dbo].[ActivityLink] WITH CHECK ADD  
       CONSTRAINT [FK_ActivityLink_CreatedByPerson] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between ActivityLink and Activity
ALTER TABLE [dbo].[ActivityLink] WITH CHECK ADD  
       CONSTRAINT [FK_ActivityLink_Activity1] FOREIGN KEY([Activity1])
REFERENCES [dbo].[Activity] ([ActivityId])
ON DELETE NO ACTION
GO
-- Define the relationship between ActivityLink and Activity
ALTER TABLE [dbo].[ActivityLink] WITH CHECK ADD  
       CONSTRAINT [FK_ActivityLink_Activity2] FOREIGN KEY([Activity2])
REFERENCES [dbo].[Activity] ([ActivityId])
ON DELETE NO ACTION
GO
-- Define the relationship between ActivityLink and Person
ALTER TABLE [dbo].[ActivityLink] WITH CHECK ADD  
       CONSTRAINT [FK_ActivityLink_LastChangedBy] FOREIGN KEY([LastChangedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO